package com.shop.service;

import com.shop.common.SetMeta;
import com.shop.common.page.UserPage;
import com.shop.entity.Manager;
import com.shop.entity.vo.ManagerRoleVo;
import com.shop.exception.UserException;

import java.util.List;

public interface ManagerService {
    /**
     * 分页查询
     * @param pageNum
     * @param pageSize
     * @return
     */
    SetMeta<UserPage<List<ManagerRoleVo>>> selectPage(String query, Integer pageNum, Integer pageSize);

    /**
     * 根据用户名查找用户
     * @param username
     * @return
     */
    SetMeta<ManagerRoleVo> selectByUsername(String username) throws UserException;

    /**
     * 添加用户
     * @param managerRoleVo
     * @return
     */
    SetMeta<ManagerRoleVo> insert(ManagerRoleVo managerRoleVo) throws UserException;

    /**
     * 修改用户状态
     * @param uid
     * @param type
     * @return
     */
    SetMeta<Manager> updateType(Integer uid, Boolean type);

    /**
     * 根据ID查询用户信息
     * @param id
     * @return
     */
    SetMeta<Manager> selectOne(Integer id);

    /**
     * 编辑用户提交
     * @param id
     * @param email
     * @param mobile
     * @return
     */
    SetMeta<Manager> updateUser(Integer id, String email, String mobile);

    /**
     * 删除单个用户
     * @param id
     * @return
     */
    SetMeta<Manager> deleteUser(Integer id);

    /**
     * 分配用户角色
     * @param id
     * @param manager
     * @return
     */
    SetMeta<Manager> updateRole(Integer id, Manager manager) throws UserException;

    Manager getUsername(String username);

    String getUserAuthorityInfo(Integer id);

    void clearUserAuthorityInfo(String username);

    void clearUserAuthorityInfoByRoleId(Long roleId);

    void clearUserAuthorityInfoByMenuId(Long menuId);
}
